<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //表达式和case值是全等的关系才执行
        var fruit_name = prompt('请输入你要查询的水果');

        switch (fruit_name) {
            case '苹果':
                alert('5元1斤');
                break;
            case '草莓':
                alert('10元1斤');
                break;
            case '榴莲':
                alert('80元1斤');
                break;
            default:
                alert('该商店没有这种水果');
        }
    </script>
</head>

<body>

</body>

</html>